package com.macro.mall.tiny.modules.foster.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.macro.mall.tiny.modules.foster.mapper.ItemMapper;
import com.macro.mall.tiny.modules.foster.model.Item;
import com.macro.mall.tiny.modules.foster.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhuyi
 * @since 2024-04-03
 */
@Service
public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements ItemService {
    @Autowired
    private ItemMapper itemMapper;

    @Override
    public Page<Item> pageItem(Page<Item> page, Integer type) {
        LambdaQueryWrapper<Item> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper
                .eq(type != null, Item::getType, type);
        Page<Item> itemPage = itemMapper.selectPage(page, queryWrapper);
        return itemPage;
    }
}
